package com.controller.medical;

import com.comm.R;
import com.comm.vo.medicinevo.SupperlierView;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/medicine/supplier")
@Api(value = "药品进销存模块",tags = "供应商维护的所有接口API")
@ApiResponses({
        @ApiResponse(code=200,message="请求成功"),
        @ApiResponse(code=404,message="找不到页面"),
        @ApiResponse(code=405,message="请求方法错误"),
        @ApiResponse(code=500,message="后台服务错误")
})
public class SupplierController {

    //查询供应商信息
    @RequestMapping(value = "/findSupList",method = RequestMethod.GET)
    @ApiOperation(value = "查询供应商信息",notes = "查询供应商信息",httpMethod = "GET", response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage",value = "当前页",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "pageSize",value = "每页的条数",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "supName",value = "供应商名称",paramType = "query",dataType = "String",required = false),
            @ApiImplicitParam(name = "contact",value = "联系人",paramType = "query",dataType = "String",required = false)
    })

    public String findSupList(String currentPage,String pageSize,String supName, String contact) {
        return "{\n" +
                "\t\"id\": 1,\n" +
                "\t\"sup_name\": \"b\",\n" +
                "\t\"contact\": \"李四\",\n" +
                "\t\"landline\": \"010-65234567\",\n" +
                "\t\"phone\": 18732564789,\n" +
                "\t\"card\": 622021706004742145,\n" +
                "\t\"address\": \"云南\",\n" +
                "\t\"create_time\": \"2022-09-10 10:16:53\"\n" +
                "}";
    }

    //增加供应商信息
    @RequestMapping(value = "/addSup",method = RequestMethod.POST)
    @ApiOperation(value = "增加供应商信息",notes = "增加供应商信息",httpMethod = "POST", response = R.class)
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "supName",value = "供应商名称",paramType = "query",dataType = "String",required = false),
//            @ApiImplicitParam(name = "contact",value = "联系人",paramType = "query",dataType = "String",required = false),
//            @ApiImplicitParam(name = "landline",value = "座机",paramType = "query",dataType = "String",required = false),
//            @ApiImplicitParam(name = "phone",value = "手机",paramType = "query",dataType = "String",required = false),
//            @ApiImplicitParam(name = "card",value = "银行卡",paramType = "query",dataType = "String",required = false),
//            @ApiImplicitParam(name = "address",value = "地址",paramType = "query",dataType = "String",required = false)
//    })
    @ResponseBody
    public R addSup(@RequestBody @ApiParam(name = "supperlierView",value = "供应商信息实体",required = true) SupperlierView supperlierView) {
        R r = new R();
        r.setCode(200);
        r.setMsg("添加成功！");
        String data = "{\n" +
                "\t\"id\": 1,\n" +
                "\t\"sup_name\": \"b\",\n" +
                "\t\"contact\": \"李四\",\n" +
                "\t\"landline\": \"010-65234567\",\n" +
                "\t\"phone\": 18732564789,\n" +
                "\t\"card\": 622021706004742145,\n" +
                "\t\"address\": \"云南\",\n" +
                "\t\"create_time\": \"2022-09-10 10:16:53\"\n" +
                "}";
        r.setData(data);
        return r;
    }

    //修改供应商信息
    @RequestMapping(value = "/updateSup",method = RequestMethod.POST)
    @ApiOperation(value = "添加修改供应商信息接口",notes = "传递信息",httpMethod = "post", response = R.class)
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "supName",value = "供应商名称",paramType = "query",dataType = "String",required = false),
//            @ApiImplicitParam(name = "contact",value = "联系人",paramType = "query",dataType = "String",required = false),
//            @ApiImplicitParam(name = "landline",value = "座机",paramType = "query",dataType = "String",required = false),
//            @ApiImplicitParam(name = "phone",value = "手机",paramType = "query",dataType = "String",required = false),
//            @ApiImplicitParam(name = "card",value = "银行卡",paramType = "query",dataType = "String",required = false),
//            @ApiImplicitParam(name = "address",value = "地址",paramType = "query",dataType = "String",required = false)
//    })
    @ResponseBody
    public R updateSup(@RequestBody @ApiParam(name = "supperlierView",value = "供应商信息实体",required = true) SupperlierView supperlierView) {
        R r = new R();
        r.setCode(200);
        r.setMsg("修改成功！");
        return r;
    }


    //删除供应商信息
    @RequestMapping(value = "/deleteSup",method = RequestMethod.POST)
    @ApiOperation(value = "添加修改供应商信息接口",notes = "传递信息",httpMethod = "post", response = R.class)
    @ApiImplicitParam(name = "id",value = "供应商id",paramType = "query",dataType = "String",required = false)
    @ResponseBody
    public R deleteSup(@RequestParam(name = "id")Integer id) {
        R r = new R();
        r.setCode(200);
        r.setMsg("删除成功！");
        return r;
    }


}
